﻿<div ng-controller="chargeController">
	<div class="wrapper border-bottom white-bg page-heading">
		<div class="col-lg-pull-12">
			<ol class="breadcrumb">
				<li>收款</li>
			</ol>
		</div>
	</div>
	<form class="form-horizontal row">
		<div class="form-group">
			<div class="col-sm-4">
				<label class="col-sm-4 control-label">商户号</label>
				<div class="col-sm-8">
					<input name="merchant_no" type="text" class="form-control input-sm" ng-model="query.merchant_no">
				</div>
			</div>
			<div class="col-sm-4">
				<label class="col-sm-4 control-label">手机号</label>
				<div class="col-sm-8">
					<input name="mobile" type="text" class="form-control input-sm" ng-model="query.mobile">
				</div>
			</div>
			<div class="col-sm-4">
				<label class="col-sm-4 control-label">姓名</label>
				<div class="col-sm-8">
					<input name="name" type="text" class="form-control input-sm" ng-model="query.name">
				</div>
			</div>
		</div>
		<div class="form-group">
			<div class="col-sm-4">
				<label class="col-sm-4 control-label">单号</label>
				<div class="col-sm-8">
					<input name="order_no" type="text" class="form-control input-sm" ng-model="query.order_no">
				</div>
			</div>
			<div class="col-sm-4">
				<label class="col-sm-4 control-label">OEM商户</label>
				<div class="col-sm-8">
					<ui-select ng-model="query.merchant_id" theme="bootstrap">
						<ui-select-match placeholder="选择OEM商户">{{$select.selected.name}}</ui-select-match>
						<ui-select-choices repeat="item.id as item in oems | propsFilter: {name: $select.search}">
							<span ng-bind="item.name"></span>
						</ui-select-choices>
					</ui-select>
				</div>
			</div>
			<div class="col-sm-4">
				<label class="col-sm-4 control-label">状态</label>
				<div class="col-sm-8">
					<select class="form-control input-sm" ng-model="query.status">
						<option value="">全部</option>
						<option value="1">待支付</option>
						<option value="2">已支付</option>
						<option value="3">不确定</option>
						<option value="4">失败</option>
						<option value="5">已关闭</option>
					</select>
				</div>
			</div>
		</div>
		<div class="form-group">
			<div class="col-sm-4">
				<label class="col-sm-4 control-label">通道</label>
				<div class="col-sm-8">
					<select class="form-control input-sm" ng-model="query.pay_channel">
						<option value="0">全部</option>
						<option value="1">HF(1)</option>
						<option value="2">Jwuct(2)</option>
						<option value="3">HxData(3)</option>
						<option value="4">KY(4)</option>
						<option value="5">SFB(5)</option>
						<option value="6">RPAY(8)</option>
						<option value="8">RPAYOUT(8)</option>
						<option value="9">hxdata2(9)</option>
						<option value="10">RPAY2(10)</option>
						<option value="11">xsft(11)</option>
						<option value="12">睿付4511(12)</option>
						<option value="13">xsft烟草(13)</option>
						<option value="14">xsft百货(14)</option>
						<option value="15">rpayBh百货(15)</option>
						<option value="16">开联通支付(16)</option>
						<option value="17">top封顶支付(17)</option>
						<option value="18">首信易支付(18)</option>
						<option value="19">景区支付(19)</option>
						<option value="20">商旅支付(20)</option>
						<option value="21">百货支付(21)</option>
						<option value="23">slscore支付(23)</option>
						<option value="25">ltd支付(25)</option>
					</select>
				</div>
			</div>
			<div class="col-sm-4">
				<label class="col-sm-4 control-label">订单时间</label>
				<div class="col-sm-8">
					<div date class="input-group date">
						<input class="form-control input-sm" ng-model="query.start_time">
						<span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
					</div>
				</div>
			</div>
			<div class="col-sm-4">
				<div class="col-sm-8">
					<div date class="input-group date">
						<input class="form-control input-sm" ng-model="query.end_time">
						<span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
					</div>
				</div>
			</div>
		</div>
		<div class="form-group">
			<div class="col-sm-4">
				<label class="col-sm-4 control-label">订单类型</label>
				<div class="col-sm-8">
					<select class="form-control input-sm" ng-model="query.type">
						<option value="0">全部</option>
						<option value="1">收款</option>
						<option value="2">升级</option>
						<option value="3">商品交易</option>
						<option value="4">不分账</option>
						<option value="5">代付充值</option>
					</select>
				</div>
			</div>
		</div>
		<div class="form-group">
			<div class="col-sm-4">
				<div class="col-sm-offset-4 col-sm-8">
					<a class="btn btn-primary btn-sm" ui-sref="app.charge.list(query)"><i class="fa fa-search"></i> 查询</a>
					<a class="btn btn-primary btn-sm" ng-click="search()"><i class="fa fa-refresh"></i> 刷新</a>
					<!--<button class="btn btn-primary btn-sm"><i class="fa fa-download"></i> 导出</button>-->
				</div>
			</div>
			<div class="col-sm-8">
				<div class="col-sm-12">
					<div class="form-control-static text-right">支付金额：{{model.pay_amount}} 实收金额:{{model.amount}}</div>
				</div>
			</div>
		</div>
	</form>
	<table class="table table-hover m-t-md">
		<thead>
			<tr style="background-color: #f7f7f9;">
				<th>订单号</th>
				<th>商户</th>
				<th>状态</th>
				<th>订单金额</th>
				<th>补贴</th>
				<th>应付金额</th>
				<th>手续费</th>
				<th>结算费</th>
				<th>实收金额</th>
				<th width="85">订单时间</th>
				<th width="185">操作</th>
			</tr>
		</thead>
		<tbody ng-repeat="item in model.rows">
			<tr ng-dblclick="item.show=!item.show">
				<td>{{item.order_no}}<br />{{type_name(item.type)}}</td>
				<td>{{item.binder.name}}<br />{{item.merchant.name}}</td>
				<td>{{status_name(item.status)}}</td>
				<td>{{item.order_amount}}</td>
				<td>{{item.subsidy_amount}}</td>
				<td>{{item.pay_amount}}</td>
				<td>{{item.fee_amount}}</td>
				<td>{{item.settle_fee}}</td>
				<td>{{item.amount}}</td>
				<td>{{item.order_time}}</td>
				<td>
					<a class="btn btn-primary btn-xs" ng-click="item.show=!item.show"><i class="fa fa-cog"></i> 详情</a>
					<button class="btn btn-primary btn-xs" ng-click="charge_first(item)" btn-loading="psdisabled" ng-if="item.status!=2"
							loading-text="处理中..." ng-disabled="psdisabled">
						<i class="fa fa-credit-card"></i> 查询
					</button>
					<button class="btn btn-primary btn-xs" ng-click="charge_notice(item)" btn-loading="psdisabled" loading-text="处理中..." ng-disabled="psdisabled">
						<i class="fa fa-volume-up"></i> 通知
					</button>
				</td>
			</tr>
			<tr ng-show="item.show">
				<td colspan="11">
					<p>支付方式：{{item.pay_info.pay_name}} 通道：{{item.pay_info.pay_channel|channel_name}} 结算：{{item.pay_info.settle_type}} 交易号：{{item.pay_info.pay_no}} 支付流水号：{{item.pay_info.transaction_no}} </p>
					<p><span ng-repeat="m_profit in item.profit">商户：{{m_profit.merchant_no}}:￥{{m_profit.amount}}{{m_profit.freeze?"(冻结)":""}} </span></p>
					{{item.fail}}
				</td>
			</tr>
		</tbody>
	</table>
	<div class="row">
		<div class="col-md-12">
			<uib-pagination total-items="model.total_result" items-per-page="model.size" ng-model="model.page" num-pages="model.total_pages"
							ng-change="search_page(model.page)" class="pagination-sm" boundary-links="true" boundary-link-numbers="true" max-size="20"
							previous-text="&lsaquo;" next-text="&rsaquo;" first-text="&laquo;" last-text="&raquo;"></uib-pagination>
			<span class="pull-right" style="margin: 30px 0px 20px 0px">共{{model.total_result}} 当前：{{model.page}}/{{model.total_pages}}</span>
		</div>
	</div>
</div>
